var test ={
	init: function() {
		google.load('visualization', '1.0', {'packages':['corechart']});
//		this._test();
		this._barChart();
//		this._lineChart();
//		this._comboChart();
	},

	_test: function() {
		console.log('ok');
	},


	_barChart: function() {
		console.log('chart');
		function barChart() {
//			var data = google.visualization.arrayToDataTable([
//			  ['Year', 'Call', 'On Hold','Admin'],
//			  ['Jan',  100,200,234],
//			  ['Feb',  270,203,345],
//			  ['Mar',  360,56,456],
//			  ['Apr',  430,89,345],
//			  ['May', 123,423,352],
//			  ['Jun',  400,433,346],
//			  ['Jul',  670,234,234],
//			  ['Aug',  660,34,321],
//			  ['Sep', 234,567,232],
//			  ['Oct',  400,45,230],
//			  ['Nov',  570,45,234],
//			  ['Dec',  260,234,432]
//			]);

			var oDataTable = new google.visualization.DataTable();
			oDataTable.addColumn('string', 'Month');
			oDataTable.addColumn('number', 'Call');
			oDataTable.addColumn('number', 'On Hold');
			oDataTable.addColumn('number', 'Admin');
//			oDataTable.addColumn({'type':'string', 'p':{'html':true}});

			oDataTable.addRows([
			  ['Jan',  500,200,234],
			  ['Feb',  270,203,345]
			]);

			var options = {
			  title: 'Company Performance',
			  hAxis: {
				  title: 'Year',
				  titleTextStyle: {color: 'red'},
				  slantedText:false,
				  showTextEvery:1,
				  minorGridlines:{count:2}},
			  isStacked : true,
			  colors: ['#0093D8','#00BFE5','#00DEB0'],
			  bar: {groupWidth:'98%'},
			  vAxis: {textPosition:'out'},
			  legend: {
				  position:'in'
			  },
			  isHtml: false
			};

			var chart = new google.visualization.ColumnChart(document.getElementById('iDivBarChart'));
			chart.draw(oDataTable, options);

		}

		google.setOnLoadCallback(barChart);

	},

	_lineChart: function(){
	  function drawChart1() {
			var data = google.visualization.arrayToDataTable([
			  ['Year', 'Sales', 'Expenses'],
			  ['2004',  1000,      400],
			  ['2005',  1170,      460],
			  ['2006',  660,       1120],
			  ['2007',  1030,      540]
			]);

			var options = {
			  title: 'Company Performance'
			};

			var chart = new google.visualization.LineChart(document.getElementById('iDivBarChart'));
			chart.draw(data, options);
      }

	  google.setOnLoadCallback(drawChart1);
	},

	_comboChart: function() {
		 console.log('chart');

		 function drawVisualization() {
			// Some raw data (not necessarily accurate)
			var data = google.visualization.arrayToDataTable([
			  ['Month', 'Call', 'On Hold', 'Admin', 'target', 'channel'],
			  ['Jan',  165,538, 522, 900, 1000],
			  ['Feb',  135,820, 599, 900,900],
			  ['Mar',  157,467,587, 900,852],
			  ['Apr',  139,810,615, 900,900],
			  ['May',  136,691,629, 900,600],
			  ['Jun',  165,438, 522, 900,966],
			  ['Jul',  135,540, 599, 900,866],
			  ['Aug',  157,467,587, 900,831],
			  ['Sep',  139,610,615, 900,825],
			  ['Oct',  157,167,587, 900,553],
			  ['Nov',  139,510,615, 900,685],
			  ['Dec',  136,691,629, 900,855]
			]);

			var options = {
			  title : 'Monthly Coffee Production by Country',
			  vAxis: {title: "Cups", minValue:0},
			  hAxis: {title: "Month", minValue:0},
			  seriesType: "bars",
			  series: {
				  3: {type: "line", visibleInLegend: true, legend:'right' },
				  4:{type:'line'}
			  },
			  colors: ['#0093D8','#00BFE5','#00DEB0', '#D6F6D6', '#F9D3D3'],
			  isStacked : true,
			  bar: {groupWidth:'98%'},
//			  vAxis: {textPosition:'out'},
			  legend: 'none'
//			  viewWindow: {min:0}


			};

			var chart = new google.visualization.ComboChart(document.getElementById('iDivComboChart'));
			chart.draw(data, options);
        }

		google.setOnLoadCallback(drawVisualization);
	}


}

test.init();


//	// Load the Visualization API and the piechart package.
//	google.load('visualization', '1.0', {'packages':['corechart']});
//
//	// Set a callback to run when the Google Visualization API is loaded.
//	google.setOnLoadCallback(drawChart);
//	google.setOnLoadCallback(drawChart1);
//	google.setOnLoadCallback(barChart);
//
//	// Callback that creates and populates a data table,
//	// instantiates the pie chart, passes in the data and
//	// draws it.
//	function drawChart1() {
//
//		// Create the data table.
//		var data = new google.visualization.DataTable();
//		data.addColumn('string', 'Topping');
//		data.addColumn('number', 'Slices');
//		data.addRows([
//		  ['Mushrooms', 3],
//		  ['Onions', 1],
//		  ['Olives', 1],
//		  ['Zucchini', 1],
//		  ['Pepperoni', 2]
//		]);
//
//		// Set chart options
//		var options = {'title':'How Much Pizza I Ate Last Night',
//					   'width':400,
//					   'height':300};
//
//		// Instantiate and draw our chart, passing in some options.
//		var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
//		chart.draw(data, options);
//	}
//
//	function drawChart() {
//
//		// Create the data table.
//		var data = new google.visualization.DataTable();
//		data.addColumn('string', 'Topping');
//		data.addColumn('number', 'Slices');
//		data.addRows([
//		  ['Mushrooms', 3],
//		  ['Onions', 1],
//		  ['Olives', 1],
//		  ['Zucchini', 1],
//		  ['Pepperoni', 2]
//		]);
//
//		// Set chart options
//		var options = {'title':'Hey this is two',
//					   'width':400,
//					   'height':300};
//
//		// Instantiate and draw our chart, passing in some options.
//		var chart = new google.visualization.PieChart(document.getElementById('chart2'));
//		chart.draw(data, options);
//	}
//
